package pub.gll.plugin.extension;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import pub.gll.plugin.util.Log;

/**
 * {@link pub.gll.plugin.Configuration}
 * @author yuqiang
 */
public class ClassKnifeExtension {

    private static final int DEBUG_NO_CONFIG = -1;
    private static final int DEBUG_CLOSE = 0;
    private static final int DEBUG_OPEN = 1;

    private boolean enable;
    private int debug = DEBUG_NO_CONFIG;
    private int logLevel = Log.LOG_LEVEL_INFO;
    private List<String> includes = new ArrayList<>();
    private List<String> excludes = new ArrayList<>();
    public ClassKnifeExtension() {
        enable = true;
    }

    public ClassKnifeExtension exclude(String...filters) {
        if (filters != null) {
            this.excludes.addAll(Arrays.asList(filters));
        }
        return this;
    }

    public ClassKnifeExtension include(String...filters) {
        if (filters != null) {
            this.includes.addAll(Arrays.asList(filters));
        }
        return this;
    }

    public boolean isDebugConfig() {
        return debug != DEBUG_NO_CONFIG;
    }

    public boolean isDebug() {
        return debug == DEBUG_OPEN;
    }

    public int getLogLevel() {
        return logLevel;
    }

    public void setLogLevel(int logLevel) {
        this.logLevel = logLevel;
    }

    public List<String> getExcludes() {
        return this.excludes;
    }

    public List<String> getIncludes() {
        return this.includes;
    }

    public int getDebug() {
        return debug;
    }

    public void setDebug(int debug) {
        this.debug = debug;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }
}